/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package actions;

/**
 *
 * @author mpastarini
 */
public class ActionFactory {

    private ActionFactory() {}

    public static Action getAction(String actionName) throws Exception
    {
        try
        {
            return (Action)(Class.forName("actions." + actionName + "Action")).newInstance();
        }
        catch(InstantiationException e1) 
        {
            throw new Exception ("ActionFactory: " + e1.getMessage());
        } 
        catch(IllegalAccessException e2) 
        {
            throw new Exception ("ActionFactory: " + e2.getMessage());
        }        
        catch(ClassNotFoundException e3)
        {
            throw new Exception ("ActionFactory: " + e3.getMessage());
        }
    }

}
